home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.4 KB | 54 lines | [TEXT/GEOL] |
- Item forwarded by ALCABES to CPLUS.APPLE$
-
- Item 6591703 24-Dec-89 05:09
-
- From: MADA.EUROPE MacApp Dev Assoc Europe, E Carrasco
-
- To: CPLUS.DEV$ C++ Interest List--Developers
-
- Sub: ?Overloading the new operator
-
- Attn: C++ developers
- ⁄ CPlus.Dev$
-
- From: Vincent Hoffmann
- Gimeor
- ⁄ MADA.Europe
-
- Sub: Overloading the new operator.
-
- Hi all,
- We are learning MacApp and C++ at MADA Europe trainings.
- We want a lot of Graphic Segments on screen and don't want to use Pascal
- Objects (Handles). We need to overload the operators new and delete to allocate
- our objects (and their fields) in memory.
-
- /* Is this interface correct? */
- Class TGraphicSegment { // a PointerObject
- private:
- long fSize
- long fAddress
- /* ... */
- public:
- void* operator new(long logicalSize)
- void* TGraphicSegment::operator delete(void* space)
- /* ... */
- };
-
-
- /* Implementation */
- void* TGraphicSegment::operator new(size_t logicalSize) {
- /* ... */
- return aSeg;
- };
-
- How could we implements the new operator? Objects and their fields have to be
- places in a specific location in our heap (a big block allocated at the
- beginning of the application). Each object knows its size, location, and other
- properties.
-
-
- Thanks for your help
- Yves
-
-